Template talk:Monsym
I thought I'd do my civic duty and update Genocide to use monsym, after seeing that chickatrice was hard coded to be yellow, not brown. It seemed timely to update the page to use Monsym instead and make everyone happy. After making a couple of tiny changes to this template (monsym can now be used in-line with following text and not carriage return after the symbol, gypsie is now an allowed monster name) I noticed that there is a major issue with either the Wiki itself or this template. It seems there is a specific limit on the number of times (21?) Monsym or one of it's sub-function (switch? see reasoning below) can be called. I suspect it is a Wiki limit on the number of times a subroutine can be called, but I am not sure. Here's what brought this on and my reasoning: On the Genocide page, the use of monsym broke after printing perfectly up until the table for use with a blessed croll. After "quadrupeds", the 21st call of Monsym, further use of monsym would break. The next immediate use of monsym just printed (complete with link) "#switch:", and then every use of monsym after that simply printed a link to Template:Monsym. * Initially I thought it was simply a missed case or I made a spelling mistake for Vampire, so I changed the template to use vampire_lord, still broken. * I double checked both entries were in Monsym, still broken. * I then REMOVED (temporarily) the table entry for Vampires entirely, and the same error immediately passed on to the next table item (Zombies) instead. Still broken. * Restoring Vampire made no difference. I was convinced I was poking more in to the inner workings than I should, so I stopped. This effect was not expected usage and I didn't know why. I applied judicious use of the Undo function and rolled back my changes to Genocide to use the previous version with the original hard-coded colours. As I don't want to clog things up and only make a half-baked solution (if any), I now seek those with greater wiki-fu to assist. Sorry for the problems with Genocide, and this rambling talk page (I hate not knowing what happened in a wikia error). -- Kalon 00:49, 26 February 2008 (UTC) :Bleh. I should've guessed there would be something like that... It was hard enough finding proper documentation about coding a #switch in the first place. Hopefully there's a solution for it. --Paxed 07:03, 26 February 2008 (UTC) :I just optimized the template a bit; you can now include monsym approximately 34 times per page. This is only approximation, because all the other included Templates also use the same allocation, AFAIK. So, probably 30 times is safe. --Paxed 08:26, 26 February 2008 (UTC) ::Some more optimizations; now you can include this template approximately 200 times in a page. See User:Paxed/Monsymtest --Paxed 10:07, 26 February 2008 (UTC) A note on the version writeups This template should probably not be used on the version writeups (such as this one), because these document specific versions of the game. Otherwise, a fine bit of coding.--Ray Chason 03:03, 26 February 2008 (UTC) HTML rendering and function calls I have changed the symbol definition for sea monsters (;) and reptiles (:) to use direct HTML coding (#86; and #85; respectively) as they were not displaying properly as they interrupted the function call and caused no symbol to appear and a carriage retunr to be inserted. The use of direct symbol coding may cause some obscure encoding schema to display incorrect characters or nothing at all, but the majority of users will see what is expected. -- Kalon 22:06, 26 February 2008 (UTC) Black background gone? When (and why/how) did the black background disappear from the monster symbols? Now white characters (like most humans etc) don't appear on a normal page... -- Kalon 04:39, 28 February 2008 (UTC) * I hate double-posting, but I see that the use of nhsym in common.css has caused this issue, even though the appropiate background: item is included in it... -- Kalon 04:49, 28 February 2008 (UTC) : Your browser was using old, cached version of common.css. --Paxed 17:11, 28 February 2008 (UTC) Further optimisation of monsym? I've made a prototype of this template that can be used literally thousands of times on a single page (I gave up after a 115k page with 4000 uses). The old one gives out at around 195 in my simple test. The new template's mechanism is quite different; rather than code all the variations in a single template, which is inefficient because of the way the Wiki works, I coded it to include a sub-page which contains just the code for a single monster. This allows the Wiki to do what it is good at, which is look pages up, rather than what it is clearly bad at, resolving multiple complex templates on a single page. (I think it simply substitutes in all the templates first, then works out the result, including any conditionals, on the fully-substituted page!) Template is at User:Rogerb-on-NAO/monsym. Because it relies on sub-pages, I created only 2; "Death" and "Gnome king". Use it like this: gives: Generalising it would be a "simple" matter of adding the required 300-odd sub-pages. Advantages *Lightweight; can be used literally thousands of times *Can be used on pages such as Monster, Monsters (by difficulty) etc., Template:Monsters, ... which currently need to be hand-edited. *Retains the key advantage of only having to change one thing if a monster symbol/colour changes *Can simply overwrite current Template:monsym without causing any issues *Changing the symbol for one monster won't accidentally affect others Disadvantages *Uses a lot more pages (but 300-odd doesn't add significantly to our current count, and I recall someone saying somewhere a whole bunch of tiny pages isn't a big load for the wiki). *Someone needs to create the 300+ sub-pages (maybe a bot could do it?) *changing multiple monsters will require lots of small edits rather than one big one What do people think? --Rogerb-on-NAO 11:27, 20 June 2008 (UTC) :No, really I value your opinions on this, even if it's Pointless waste of time, no-one will want to bot this and there's no way we're letting ''YOU loose with a bot. Fugeddaboutit'' --Rogerb-on-NAO 22:42, 10 July 2008 (UTC) ::Hiya, ::I just spent a good while trying to figure out how to add a monster symbol. Even though I managed to add a new symbol I still don't understand how the template works -- and I think I'm pretty good with Mediawiki code. Also, I don't know if adding a monster symbol can break something, so I just reverted my edit. So, I'm strongly for taking your method into use. The individual pages can be kept under the namespace of this template, as in Template:Monsym/gnome king, Template:Monsym/death, etc. Adding a monster would then be extremely easy. ::The problem is that I don't know anything about bots but if you can create a bot that would do this automatically then go ahead. As a bureaucrat it won't be a problem for me to arrange bot-rights for a user. ::Also, well, things can be created manually. If we modify Template:Monsters to have links to the new pages, it should be a breeze. ::Let me know if you are still interested in doing this! ::—ZeroOne (talk / ) 14:28, 29 August 2009 (UTC) :I did a quick bot run to create the subpages after ZeroOne asked on IRC for help in creating them, and switched the template (and ) over to the new syntax. I did it a little inefficiently, in that I first pulled the titles for the subpages directly from User:ZeroOne/Sandbox before realizing that they needed some normalization: as a result, for example , and are now all redirects to . On the other hand, at least this makes it a bit more convenient to use the subtemplates directly, should someone want to do that. (It's probably a bit more efficient, but I doubt it makes much difference.) --Ilmari Karonen 14:49, 30 August 2009 (UTC) ::Would you mind modifying your script and running it on the SLASH'EM monsters at User:ZeroOne/Sandbox? Notice that there is at least one special case where the symbol is different in SLASH'EM than it is in vanilla NetHack -- the zruty. And please let me know what your IRC nickname is... —ZeroOne (talk / ) 15:28, 30 August 2009 (UTC) :::I suppose the SLAHS'EM version would have to be "zruty (SLASH'EM)", then. And I'm Vyznev on IRC. --Ilmari Karonen 23:17, 30 August 2009 (UTC) :Ps. What should we do about the werefoos? Currently, e.g. and work, but isn't defined. I'm tempted to create it as something like " / ", but admittedly that would diverge from all the other subtemplates (which only produce a single character each). Any ideas? --Ilmari Karonen 15:02, 30 August 2009 (UTC) ::I'd go with the " / " syntax you proposed. After all you cannot know which form is being referred to if one only talks about a "werefoo". SLASH'EM monsters introduce a new problem with monsters such as werepanther, it cannot be called "werepanther (dog)" but I guess the straight-forward solution is to call it "werepanther (feline)" -- or to call all werefoo animal forms "werefoo (animal)". —ZeroOne (talk / ) 15:28, 30 August 2009 (UTC) :::The "werefoo (animal)" syntax makes sense to me. I think I'll move the existing ones ( , and ). --Ilmari Karonen 23:17, 30 August 2009 (UTC) :I added subtemplates for all the SLASH'EM monsters you listed. I also created a simple helper template, , and used it on the undisambiguated werefoo subpages. --Ilmari Karonen 00:21, 31 August 2009 (UTC) ::Awesome, thank you. Now we only need to create proper articles for all of those SLASH'EM monsters, too. ;) —ZeroOne (talk / ) 21:55, 31 August 2009 (UTC)